home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Just Call Me Internet
/
Just Call Me Internet.iso
/
prog
/
atari
/
m2
/
cat3src
/
cat
/
catlog.i
< prev
next >
Wrap
Text File
|
1997-10-26
|
5KB
|
183 lines
IMPLEMENTATION MODULE CatLog;
(*==============================================================*
* Modul: CAT Import-Logfile *
* Autor: Johannes Gttker-Schnetmann *
* erstellt am: 09.06.1991 *
* letzte nderung am: 09.06.91 *
* Version: 1.2 *
* Interne Version: V#0001 *
*==============================================================*
*----------------------------------------------------------------------------
* Datum Vers. Autor nderung (Arbeitsbericht)
*----------------------------------------------------------------------------
* 09.06.91 1.2 JGS erste Version
*
* 13.08.91 1.216 DS Buffergren bei OpenTexfile gendert, da bei 0 32 kB
* alloziert werden.
*
*
*----------------------------------------------------------------------------
*)
IMPORT mtTextfiles;
IMPORT MagicStrings;
IMPORT MagicDOS;
IMPORT CatTypes;
IMPORT ConvertDate;
FROM MTPaths IMPORT DataPath;
CONST logName = 'catlog.txt';
VAR log : mtTextfiles.TEXTFILE;
open: BOOLEAN;
PROCEDURE WriteCard(c : LONGCARD);
BEGIN
IF open THEN
mtTextfiles.WriteLongCard(log, c, 0);
END;
END WriteCard;
PROCEDURE WriteInt (i : LONGINT);
BEGIN
IF open THEN
mtTextfiles.WriteLongInt (log, i, 0);
END;
END WriteInt;
PROCEDURE Write(c : CHAR);
BEGIN
IF open THEN
mtTextfiles.WriteChar(log, c);
END;
END Write;
PROCEDURE WriteString(REF str : ARRAY OF CHAR);
BEGIN
IF open THEN
mtTextfiles.WriteConst(log, str);
END;
END WriteString;
PROCEDURE WriteKonjString(REF str, single, plural : ARRAY OF CHAR; count: CARDINAL);
BEGIN
WriteString (str);
IF count = 1
THEN
WriteString (single)
ELSE
WriteString (plural)
END;
END WriteKonjString;
PROCEDURE WriteLn();
BEGIN
IF open THEN
mtTextfiles.WriteLn(log);
END;
END WriteLn;
PROCEDURE WriteLine(REF str : ARRAY OF CHAR);
BEGIN
WriteString(str); WriteLn();
END WriteLine;
PROCEDURE WriteTearLine();
BEGIN
WriteLine('--------------------------------------------------------------------------------');
END WriteTearLine;
PROCEDURE WriteStringNTime(REF str : ARRAY OF CHAR);
BEGIN
putTime();
WriteString(str);
END WriteStringNTime;
PROCEDURE WriteLineNTime(REF str : ARRAY OF CHAR);
BEGIN
WriteStringNTime(str);
WriteLn();
END WriteLineNTime;
(*
PROCEDURE WriteTimeCard(c : CARDINAL);
BEGIN
IF c < 10 THEN
Write('0');
END;
WriteCard(c);
END WriteTimeCard;
*)
PROCEDURE putDate();
VAR z1,z2,z3,z4 : CARDINAL;
dt : ConvertDate.Date;
str : ARRAY [0..15] OF CHAR;
BEGIN
dt := ConvertDate.UnpackDate (MagicDOS.Tgetdate());
ConvertDate.DateToText (dt, 'DD.MM.YYYY', str);
WriteString (str);
(*
z1 := MagicDOS.Tgetdate();
CardToDate(z1, z2,z3,z4); (* Jahr, Monat, Tag *)
WriteTimeCard(z4);
Write('.');
WriteTimeCard(z3);
Write('.');
WriteTimeCard(z2);
*)
END putDate;
PROCEDURE putTime();
VAR (* z1, z2, z3, z4 : CARDINAL; *)
ti: ConvertDate.Time;
str: ARRAY [0..11] OF CHAR;
BEGIN
ti := ConvertDate.UnpackTime (MagicDOS.Tgettime());
ConvertDate.TimeToText (ti, 'HH:MM:SS ', str);
WriteString (str);
(*
z1 := MagicDOS.Tgettime();
CardToTime(z1, z2,z3,z4); (* Stunde, Minute, Sekunde *)
WriteTimeCard(z2);
Write(':');
WriteTimeCard(z3);
Write(':');
WriteTimeCard(z4);
Write(' ');
*)
END putTime;
PROCEDURE OpenLog():BOOLEAN;
VAR scrap : ARRAY[0..255] OF CHAR;
BEGIN
MagicStrings.Assign(DataPath, scrap);
MagicStrings.Append(logName, scrap);
(* Buffergren verndert *)
open := mtTextfiles.OpenTextfile(scrap, mtTextfiles.WRITE, 32000, log);
putDate(); WriteString(', '); putTime();
WriteString('Log-Datei fr Einfgeprotokoll von Cat ');
WriteString(CatTypes.CatVersion);
WriteLine(' geffnet');
WriteTearLine();
RETURN open
END OpenLog;
PROCEDURE CloseLog();
BEGIN
IF open THEN
WriteTearLine();
WriteLineNTime('Einfgen beendet');
mtTextfiles.CloseTextfile(log);
open := FALSE;
END;
END CloseLog;
BEGIN
open := FALSE
END CatLog.